package com.zw.cloud.mybatis.plus.entity.stenter;

import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Sets;
import com.zw.cloud.common.exception.BizException;
import com.zw.cloud.mybatis.plus.util.BeanUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 本厂/MD 工艺 基本参数
 */
@NoArgsConstructor
@Data
public class BasicBarameter {

    @JsonProperty("key")
    private String key;
    @JsonProperty("name")
    private String name;
    @JsonProperty("sort")
    private Integer sort;
    @JsonProperty("type")
    private Integer type;
    @JsonProperty("value")
    private List<ValueDTO> value;
    @JsonProperty("dataType")
    private String dataType;
    @JsonProperty("isDynamic")
    private Boolean isDynamic;
    @JsonProperty("isRequired")
    private Boolean isRequired;
    @JsonProperty("isPercentage")
    private Boolean isPercentage;

    @NoArgsConstructor
    @Data
    public static class ValueDTO {
        private Integer id;
        private String name;
        private Integer length;
        @JsonProperty("max")
        private Integer max;
        @JsonProperty("min")
        private Integer min;
        @JsonProperty("maxOpen")
        private Boolean maxOpen;
        @JsonProperty("minOpen")
        private Boolean minOpen;
        @JsonProperty("decimalLen")
        private Integer decimalLen;
    }

    public static void main(String[] args) {
        //updateSort();
       /* ProductRecordDetail detail = new ProductRecordDetail();
        detail.setReductionAmplitude("test");
        detail.setReductionWeight("reductionWeightreductionWeightreductionWeight");
        detail.setTorsion(new BigDecimal(-100));
        detail.setLon(new BigDecimal(-100));
        checkFiledIsOutOfRange(detail);*/

        ProductRecord productRecord = new ProductRecord();
        productRecord.setUpperDoorWidth((double)0);
        checkFiledIsOutOfRange(productRecord);
    }

    private static void updateSort() {
        List<BasicBarameter> basicBarameters = buildBasicBarameters();
        basicBarameters.forEach(basicBarameter -> {
            if (basicBarameter.getSort() >= 17) {
                basicBarameter.setSort(basicBarameter.getSort() + 1);
            }
            // sort >= 21 在原来基础上 +2
            if (basicBarameter.getSort() >= 21) {
                basicBarameter.setSort(basicBarameter.getSort() + 1);
            }
        });
        // 洗后克重 weightAfterWashing
        BasicBarameter basicBarameter1 = basicBarameters.stream().filter(basicBarameter -> StringUtils.equals("还原克重", basicBarameter.getName())).findFirst().get();
        BasicBarameter weightAfterWashing = new BasicBarameter();
        BeanUtil.copy(basicBarameter1,weightAfterWashing);
        weightAfterWashing.setKey("weightAfterWashing");
        weightAfterWashing.setName("洗后克重");
        weightAfterWashing.setSort(17);
        weightAfterWashing.setIsDynamic(true);
        weightAfterWashing.setIsRequired(false);
        basicBarameters.add(weightAfterWashing);

        //  洗后门幅 washingRearDoorWidth
        BasicBarameter basicBarameter2 = basicBarameters.stream().filter(basicBarameter -> StringUtils.equals("还原门幅", basicBarameter.getName())).findFirst().get();
        BasicBarameter washingRearDoorWidth = new BasicBarameter();
        BeanUtil.copy(basicBarameter2,washingRearDoorWidth);
        washingRearDoorWidth.setKey("washingRearDoorWidth");
        washingRearDoorWidth.setName("洗后门幅");
        washingRearDoorWidth.setSort(21);
        washingRearDoorWidth.setIsDynamic(true);
        washingRearDoorWidth.setIsRequired(false);
        basicBarameters.add(washingRearDoorWidth);

        basicBarameters.sort(Comparator.comparing(BasicBarameter::getSort));

        System.out.println(JSON.toJSONString(basicBarameters));
    }

    /**
     * 根据MD/本厂 工艺配置 校验数据范围
     */
    private static void checkFiledIsOutOfRange(Object obj) {
        List<BasicBarameter> basicBarameters = buildBasicBarameters();
        Class<?> clazz = obj.getClass();
        Map<String, BasicBarameter> configMap = basicBarameters.stream().collect(Collectors.toMap(BasicBarameter::getKey, v -> v, (k1, k2) -> k2));
        List<String> errorFieldList = new ArrayList<>();

        for (Field declaredField : clazz.getDeclaredFields()) {
            declaredField.setAccessible(true);
            Object actValue = null;
            try {
                actValue = declaredField.get(obj);
            } catch (IllegalAccessException ignored) {
            }
            if (Objects.isNull(actValue)) {
                continue;
            }
            String fieldName = declaredField.getName();
            // 定前克重
            if (StringUtils.equals(fieldName,"preWeight")) {
                fieldName = "schedulePreWeight";
            }
            // 定后克重
            if (StringUtils.equals(fieldName,"gramHeft")) {
                fieldName = "scheduleGramHeft";
            }
            // 上机纬密
            if (StringUtils.equals(fieldName,"upperWeftDensity")) {
                fieldName = "upperScheduleWeftDensity";
            }
            // 下机纬密
            if (StringUtils.equals(fieldName,"weftDensity")) {
                fieldName = "scheduleWeftDensity";
            }
            // 落机门幅
            if (StringUtils.equals(fieldName,"lowerDoorWidth")) {
                fieldName = "landingDoorWidth";
            }
            BasicBarameter basicBarameter = configMap.get(fieldName);
            if (Objects.isNull(basicBarameter)) {
                continue;
            }
            String actValueStr = String.valueOf(actValue);
            // value不为空,校验数据范围
            String dataType = basicBarameter.getDataType();
            List<ValueDTO> valueList = basicBarameter.getValue();
            String name = basicBarameter.getName();
            if (StringUtils.equals("number",dataType)) {
                for (ValueDTO value : valueList) {
                    //校验数字
                    try {
                        BigDecimal bigDecimal = new BigDecimal(actValueStr);
                        BigDecimal min = new BigDecimal(value.getMin());
                        BigDecimal max = new BigDecimal(value.getMax());
                        boolean minOpen = value.getMinOpen();
                        boolean maxOpen = value.getMaxOpen();
                        boolean isError = false;
                        if (minOpen && bigDecimal.compareTo(min) <= 0) {
                            isError = true;
                        }
                        if (!minOpen && bigDecimal.compareTo(min) < 0) {
                            isError = true;
                        }
                        if (maxOpen && bigDecimal.compareTo(max) >= 0) {
                            isError = true;
                        }
                        if (!maxOpen && bigDecimal.compareTo(max) > 0) {
                            isError = true;
                        }

                        if (isError) {
                            //throw new BizException(v.getName() + "不在" + value.getMin() + "-" + value.getMax() + "范围");
                            errorFieldList.add(name);
                        }

                    } catch (Exception e) {
                        //throw new BizException( v.getName() + "不是数字类型");
                        errorFieldList.add(name);
                    }
                }
            }
            if (StringUtils.equals("string",dataType) || StringUtils.equals("text",dataType)) {
                for (ValueDTO value : valueList) {
                    if (actValueStr.length() > value.getLength()) {
                        //throw new BizException(v.getName() + "长度超过" + value.getLength());
                        errorFieldList.add(name);
                    }
                }
            }
        }
        if (CollectionUtils.isNotEmpty(errorFieldList)) {
            String errorFieldStr = errorFieldList.stream().distinct().collect(Collectors.joining(","));
            throw new BizException(errorFieldStr + " 的值超出范围");
        }
    }

    private static List<BasicBarameter> buildBasicBarameters() {
        String s = "[\n" +
                "    {\n" +
                "        \"key\":\"dryingRoomTemp\",\n" +
                "        \"name\":\"温度\",\n" +
                "        \"sort\":1,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":250,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":true,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"dryingRoomTempSetting\",\n" +
                "        \"name\":\"设定温度\",\n" +
                "        \"sort\":2,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":1000,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"speed\",\n" +
                "        \"name\":\"车速\",\n" +
                "        \"sort\":3,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":150,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":true,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"fanSpeed\",\n" +
                "        \"name\":\"循环风\",\n" +
                "        \"sort\":4,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":2000,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"circulatingAirUpper\",\n" +
                "        \"name\":\"循环风(上)\",\n" +
                "        \"sort\":5,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":2000,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"circulatingAirLower\",\n" +
                "        \"name\":\"循环风(下)\",\n" +
                "        \"sort\":6,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":2000,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"topFeed\",\n" +
                "        \"name\":\"上超喂\",\n" +
                "        \"sort\":7,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lowerFeed\",\n" +
                "        \"name\":\"下超喂\",\n" +
                "        \"sort\":8,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"brushFeed\",\n" +
                "        \"name\":\"毛刷超喂\",\n" +
                "        \"sort\":9,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"totalAmplitude\",\n" +
                "        \"name\":\"门幅\",\n" +
                "        \"sort\":10,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":350,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"exhaustSpeed\",\n" +
                "        \"name\":\"排风\",\n" +
                "        \"sort\":11,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":2000,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"convectionFan\",\n" +
                "        \"name\":\"对流扇\",\n" +
                "        \"sort\":12,\n" +
                "        \"type\":2,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"id\":1,\n" +
                "                \"name\":\"高\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\":2,\n" +
                "                \"name\":\"低\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"topFeedSpeed\",\n" +
                "        \"name\":\"上超喂速度\",\n" +
                "        \"sort\":13,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":150,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lowerFeedSpeed\",\n" +
                "        \"name\":\"下超喂速度\",\n" +
                "        \"sort\":14,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":150,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"clothPressingWheel\",\n" +
                "        \"name\":\"压布轮\",\n" +
                "        \"sort\":15,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"reductionWeight\",\n" +
                "        \"name\":\"还原克重\",\n" +
                "        \"sort\":16,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"weightAfterWashing\",\n" +
                "        \"name\":\"洗后克重\",\n" +
                "        \"sort\":17,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"schedulePreWeight\",\n" +
                "        \"name\":\"定前克重\",\n" +
                "        \"sort\":18,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"scheduleGramHeft\",\n" +
                "        \"name\":\"定后克重\",\n" +
                "        \"sort\":19,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"reductionAmplitude\",\n" +
                "        \"name\":\"还原门幅\",\n" +
                "        \"sort\":20,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"washingRearDoorWidth\",\n" +
                "        \"name\":\"洗后门幅\",\n" +
                "        \"sort\":21,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"upperDoorWidth\",\n" +
                "        \"name\":\"上机门幅\",\n" +
                "        \"sort\":22,\n" +
                "        \"type\":6,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":350,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"landingDoorWidth\",\n" +
                "        \"name\":\"落机门幅\",\n" +
                "        \"sort\":23,\n" +
                "        \"type\":6,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":350,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":true,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"rollingPressure\",\n" +
                "        \"name\":\"轧车压力\",\n" +
                "        \"sort\":24,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"rollingTension\",\n" +
                "        \"name\":\"轧车张力\",\n" +
                "        \"sort\":25,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"inputTension\",\n" +
                "        \"name\":\"进布张力\",\n" +
                "        \"sort\":26,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"outletTension\",\n" +
                "        \"name\":\"出布张力\",\n" +
                "        \"sort\":27,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"grooveTemp\",\n" +
                "        \"name\":\"轧槽温度\",\n" +
                "        \"sort\":28,\n" +
                "        \"type\":2,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"id\":1,\n" +
                "                \"name\":\"高温\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\":2,\n" +
                "                \"name\":\"中温\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\":3,\n" +
                "                \"name\":\"低温\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"upperClothRollRate\",\n" +
                "        \"name\":\"上出布辊率\",\n" +
                "        \"sort\":29,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lowerClothRollRate\",\n" +
                "        \"name\":\"下出布辊率\",\n" +
                "        \"sort\":30,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"torsion\",\n" +
                "        \"name\":\"扭度\",\n" +
                "        \"sort\":31,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"upperScheduleWeftDensity\",\n" +
                "        \"name\":\"上机纬密\",\n" +
                "        \"sort\":32,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"scheduleWeftDensity\",\n" +
                "        \"name\":\"下机纬密\",\n" +
                "        \"sort\":33,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lowerWarpDensity\",\n" +
                "        \"name\":\"下机经密\",\n" +
                "        \"sort\":34,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"scheduleElasticity\",\n" +
                "        \"name\":\"弹力\",\n" +
                "        \"sort\":35,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":false,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"liquidRate\",\n" +
                "        \"name\":\"带液率\",\n" +
                "        \"sort\":36,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"faceUp\",\n" +
                "        \"name\":\"正面朝向\",\n" +
                "        \"sort\":37,\n" +
                "        \"type\":2,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"id\":1,\n" +
                "                \"name\":\"向上\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\":2,\n" +
                "                \"name\":\"向下\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"hairDirection\",\n" +
                "        \"name\":\"毛向\",\n" +
                "        \"sort\":38,\n" +
                "        \"type\":2,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"id\":1,\n" +
                "                \"name\":\"顺\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            },\n" +
                "            {\n" +
                "                \"id\":2,\n" +
                "                \"name\":\"逆\",\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"centeringDevice\",\n" +
                "        \"name\":\"对中装置\",\n" +
                "        \"sort\":39,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":50,\n" +
                "                \"min\":5,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"rightChain\",\n" +
                "        \"name\":\"链条(右)\",\n" +
                "        \"sort\":40,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":1,\n" +
                "                \"min\":-1,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"middleSupport\",\n" +
                "        \"name\":\"中部支撑\",\n" +
                "        \"sort\":41,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":10,\n" +
                "                \"min\":-10,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"chainDistribution\",\n" +
                "        \"name\":\"链条出布\",\n" +
                "        \"sort\":42,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":125,\n" +
                "                \"min\":1,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"topUnroll\",\n" +
                "        \"name\":\"顶部退卷\",\n" +
                "        \"sort\":43,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":125,\n" +
                "                \"min\":1,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"foldingFrame\",\n" +
                "        \"name\":\"摺布架\",\n" +
                "        \"sort\":44,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":125,\n" +
                "                \"min\":1,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"feel\",\n" +
                "        \"name\":\"手感\",\n" +
                "        \"sort\":45,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"length\":15,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"string\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":false\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lon\",\n" +
                "        \"name\":\"经度\",\n" +
                "        \"sort\":46,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"lat\",\n" +
                "        \"name\":\"纬度\",\n" +
                "        \"sort\":47,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"craftShrinkage\",\n" +
                "        \"name\":\"缩率\",\n" +
                "        \"sort\":48,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"directContractionBefore\",\n" +
                "        \"name\":\"定前直缩\",\n" +
                "        \"sort\":49,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"transverseContractionBefore\",\n" +
                "        \"name\":\"定前横缩\",\n" +
                "        \"sort\":50,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"directContraction\",\n" +
                "        \"name\":\"定后直缩\",\n" +
                "        \"sort\":51,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"transverseContraction\",\n" +
                "        \"name\":\"定后横缩\",\n" +
                "        \"sort\":52,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":-100,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"fixedBackSpacing\",\n" +
                "        \"name\":\"循环条距\",\n" +
                "        \"sort\":53,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":200,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":true,\n" +
                "                \"decimalLen\":1\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"positivelyBiased\",\n" +
                "        \"name\":\"正斜\",\n" +
                "        \"sort\":54,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    },\n" +
                "    {\n" +
                "        \"key\":\"antiskew\",\n" +
                "        \"name\":\"反斜\",\n" +
                "        \"sort\":55,\n" +
                "        \"type\":1,\n" +
                "        \"value\":[\n" +
                "            {\n" +
                "                \"max\":100,\n" +
                "                \"min\":0,\n" +
                "                \"maxOpen\":false,\n" +
                "                \"minOpen\":false,\n" +
                "                \"decimalLen\":2\n" +
                "            }\n" +
                "        ],\n" +
                "        \"dataType\":\"number\",\n" +
                "        \"isDynamic\":true,\n" +
                "        \"isRequired\":false,\n" +
                "        \"isPercentage\":true\n" +
                "    }\n" +
                "]";
        return JSON.parseArray(s,BasicBarameter.class);
    }
}
